<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>embedme: src/Thread.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">embedme
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Thread.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_thread_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/******************************************************************************</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This file is part of libemb.</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * libemb is free software: you can redistribute it and/or modify</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * it under the terms of the GNU General Public License as published by</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * the Free Software Foundation, either version 3 of the License, or</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * (at your option) any later version.</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * libemb is distributed in the hope that it will be useful,</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * GNU General Public License for more details.</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * You should have received a copy of the GNU General Public License</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * along with libemb.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * Project: Embedme</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * Author : FergusZeng</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * Email  : cblock@126.com</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * git    : https://gitee.com/newgolo/embedme.git</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> * Copyright 2014~2020 @ ShenZhen ,China</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">*******************************************************************************/</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#ifndef __THREAD_H__</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#define __THREAD_H__</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160; </div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_base_type_8h.html">BaseType.h</a>&quot;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_thread_util_8h.html">ThreadUtil.h</a>&quot;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_singleton_8h.html">Singleton.h</a>&quot;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &lt;limits.h&gt;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor">#include &lt;pthread.h&gt;</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &lt;unistd.h&gt;</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#include &lt;thread&gt;</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="keyword">namespace </span>libemb{</div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="classlibemb_1_1_runnable.html">   44</a></span>&#160;<span class="keyword">class </span><a class="code" href="classlibemb_1_1_runnable.html">Runnable</a>{</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<a class="code" href="_base_type_8h.html#a57e803e49526dc5ba8c1915c68708ae0">DECL_CLASSNAME</a>(<a class="code" href="classlibemb_1_1_runnable.html">Runnable</a>)</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <a class="code" href="classlibemb_1_1_runnable.html">Runnable</a>(){};</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="classlibemb_1_1_runnable.html">Runnable</a>(){};</div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="classlibemb_1_1_runnable.html#a93b6fff84c5b0f53e5f58509cf716c9d">   53</a></span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classlibemb_1_1_runnable.html#a93b6fff84c5b0f53e5f58509cf716c9d">run</a>()=0;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;};</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160; </div>
<div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="classlibemb_1_1_thread.html">   56</a></span>&#160;<span class="keyword">class </span><a class="code" href="classlibemb_1_1_thread.html">Thread</a>{</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="keyword">enum</span> THREAD_STATE</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    {</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;        STATE_INIT=0,</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;        STATE_START,</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;        STATE_RUNNING,</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        STATE_EXIT</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    };</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <a class="code" href="classlibemb_1_1_thread.html">Thread</a>();</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <a class="code" href="classlibemb_1_1_thread.html">Thread</a>(<span class="keyword">const</span> <a class="code" href="classlibemb_1_1_thread.html">Thread</a>&amp; copy);</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="classlibemb_1_1_thread.html">Thread</a>();</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    <span class="keyword">virtual</span> std::unique_ptr&lt;Thread&gt; <a class="code" href="classlibemb_1_1_thread.html#a8d4fca9cb378d5331a1adf493ee0a6a1">clone</a>();</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_thread.html#a2e0f619868ec15de65c7940dcc94dba0">start</a>(<span class="keyword">const</span> <a class="code" href="classlibemb_1_1_runnable.html">Runnable</a>&amp; runnable);</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_thread.html#a3ba546547e2f82a1b908124ff511e97b">stop</a>(<span class="keywordtype">int</span> msTimeout=-1);</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_thread.html#a2b211bf8a128020705fad66e43ce9b5a">cancel</a>();</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_thread.html#af1e236f2cb2cec6b64621d783696c73e">isRunning</a>();</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classlibemb_1_1_thread.html#a3577f44fbdabce18815f6ca4578b6ef9">usleep</a>(<span class="keywordtype">int</span> us);</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classlibemb_1_1_thread.html#a05f5a8b508ca2ce08c66dd11e2734b82">msleep</a>(<span class="keywordtype">int</span> ms);</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classlibemb_1_1_thread.html#ad670751a6bf2d419112e46c92fc527ae">threadID</a>();</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <span class="keywordtype">void</span> threadMain();</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    <a class="code" href="classlibemb_1_1_runnable.html">Runnable</a>* m_pRunnable{<span class="keyword">nullptr</span>};</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    <span class="keywordtype">bool</span> m_runFlag{<span class="keyword">false</span>};</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    <span class="keywordtype">int</span> m_threadStatus{STATE_INIT};</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    std::unique_ptr&lt;std::thread&gt; m_thread{<span class="keyword">nullptr</span>};</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;};</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160; </div>
<div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="classlibemb_1_1_p_thread.html">  133</a></span>&#160;<span class="keyword">class </span><a class="code" href="classlibemb_1_1_p_thread.html">PThread</a>:<span class="keyword">public</span> <a class="code" href="classlibemb_1_1_thread.html">Thread</a>{</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;<a class="code" href="_base_type_8h.html#a57e803e49526dc5ba8c1915c68708ae0">DECL_CLASSNAME</a>(<a class="code" href="classlibemb_1_1_p_thread.html">PThread</a>)</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00136"></a><span class="lineno"><a class="line" href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddd">  136</a></span>&#160;    <span class="keyword">enum</span> <a class="code" href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddd">SCHED_POLICY_E</a></div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    {</div>
<div class="line"><a name="l00138"></a><span class="lineno"><a class="line" href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddda09c71044114782eba011166cbce6e593">  138</a></span>&#160;        <a class="code" href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddda09c71044114782eba011166cbce6e593">SCHED_POLICY_OTHER</a> = SCHED_OTHER, </div>
<div class="line"><a name="l00139"></a><span class="lineno"><a class="line" href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddda539ad1068e9e17018e63246eb2ee1b3d">  139</a></span>&#160;        <a class="code" href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddda539ad1068e9e17018e63246eb2ee1b3d">SCHED_POLICY_FIFO</a> = SCHED_FIFO,   </div>
<div class="line"><a name="l00140"></a><span class="lineno"><a class="line" href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddda22e3596e79010623b2761584dd92bf4b">  140</a></span>&#160;        <a class="code" href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddda22e3596e79010623b2761584dd92bf4b">SCHED_POLICY_RR</a> = SCHED_RR,       </div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    };</div>
<div class="line"><a name="l00142"></a><span class="lineno"><a class="line" href="structlibemb_1_1_p_thread_1_1_thread_attr.html">  142</a></span>&#160;    <span class="keyword">struct </span><a class="code" href="structlibemb_1_1_p_thread_1_1_thread_attr.html">ThreadAttr</a></div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    {</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        <span class="keywordtype">int</span> m_policy{<a class="code" href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddda09c71044114782eba011166cbce6e593">SCHED_POLICY_OTHER</a>};       <span class="comment">/* 调度策略:SCHED_POLICY_FIFO(优先级1~99),SCHED_POLICY_RR(优先级1~99),SCHED_POLICY_OTHER(优先级固定为0) */</span></div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;        <span class="keywordtype">int</span> m_priority{0};                      <span class="comment">/* 优先级:1~99,数字越大，优先级越高  */</span></div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        <span class="keywordtype">int</span> m_inherit{PTHREAD_INHERIT_SCHED};   <span class="comment">/* 继承方式:PTHREAD_INHERIT_SCHED(继承自父线程,忽略当前设置的属性),PTHREAD_EXPLICIT_SCHED(采用当前设置的线程属性) */</span></div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;        <span class="keywordtype">int</span> m_stackSize{PTHREAD_STACK_MIN};     <span class="comment">/* 栈大小:最小值为PTHREAD_STACK_MIN(16384) */</span></div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    };</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;    <a class="code" href="classlibemb_1_1_p_thread.html">PThread</a>();</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="classlibemb_1_1_p_thread.html">PThread</a>();</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    std::unique_ptr&lt;Thread&gt; <a class="code" href="classlibemb_1_1_p_thread.html#a5ce3c7cbf40e3808380577d0f5d94485">clone</a>() <span class="keyword">override</span>;</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_p_thread.html#aead2d7d699206b589e429a06cda8efd9">start</a>(<span class="keyword">const</span> <a class="code" href="classlibemb_1_1_runnable.html">Runnable</a>&amp; runnable) <span class="keyword">override</span>;</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_p_thread.html#a55465daa7337b735c240359a1816e364">stop</a>(<span class="keywordtype">int</span> msTimeout=-1) <span class="keyword">override</span>;</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_p_thread.html#a9aae9c9d37c8edee17e628505704cd3f">cancel</a>() <span class="keyword">override</span>;</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_p_thread.html#a7d0f9b8dbf1b0eeeffa2327041dff324">isRunning</a>() <span class="keyword">override</span>;</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classlibemb_1_1_p_thread.html#a752d39d4eb36a988b9b24886886373d0">setAttribute</a>(<span class="keywordtype">int</span> policy, <span class="keywordtype">int</span> priority, <span class="keywordtype">bool</span> inherit=<span class="keyword">false</span>,<span class="keywordtype">int</span> stackSize=0);</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classlibemb_1_1_p_thread.html#a90f937fa8c490b6df2c0f428598e88e4">usleep</a>(<span class="keywordtype">int</span> us);</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classlibemb_1_1_p_thread.html#aa0c044ad86e4305a515d53eba00fd914">msleep</a>(<span class="keywordtype">int</span> ms);</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_p_thread.html#a48db477652aa53f76eb71915bb0c786e">initWithPreemptRT</a>(<span class="keywordtype">int</span> policy, <span class="keywordtype">int</span> priority);</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classlibemb_1_1_p_thread.html#a67e79a3fcb3d211c66d5c5d13e1a2130">setCancelPoint</a>();</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;    </div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;    <span class="keywordtype">bool</span> pthreadAttrSet(pthread_attr_t&amp; pAttr);</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    <span class="keywordtype">void</span> threadMain();</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span>* startRoutine(<span class="keywordtype">void</span> *arg);</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;    pthread_t m_threadID{0};</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;    pthread_attr_t m_attribute;</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;    ThreadAttr m_threadAttribute;</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;};</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160; </div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160; </div>
<div class="line"><a name="l00246"></a><span class="lineno"><a class="line" href="classlibemb_1_1_threading.html">  246</a></span>&#160;<span class="keyword">class </span><a class="code" href="classlibemb_1_1_threading.html">Threading</a>{</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;<a class="code" href="_base_type_8h.html#a57e803e49526dc5ba8c1915c68708ae0">DECL_CLASSNAME</a>(<a class="code" href="classlibemb_1_1_threading.html">Threading</a>)</div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;    <a class="code" href="classlibemb_1_1_threading.html">Threading</a>(){};</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="classlibemb_1_1_threading.html">Threading</a>(){};</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Function, <span class="keyword">typename</span>... Args&gt; </div>
<div class="line"><a name="l00259"></a><span class="lineno"><a class="line" href="classlibemb_1_1_threading.html#aa3d8e3bf974a6cc2eeb5837a52662dd8">  259</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_threading.html#aa3d8e3bf974a6cc2eeb5837a52662dd8">threading</a>(Function&amp;&amp; f, Args&amp;&amp;... args)</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;    {</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;        <span class="keyword">auto</span> thread = std::make_unique&lt;std::thread&gt;(f,args...);</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;        <span class="keywordflow">if</span> (thread==<span class="keyword">nullptr</span>)</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;        {</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;        }</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;        m_threads.push_back(std::move(thread));</div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;    }</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Function, <span class="keyword">typename</span>... Args&gt; </div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;    <span class="keywordtype">bool</span> pthreading(Function&amp;&amp; f, Args&amp;&amp;... args)</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;    {</div>
<div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;        <span class="keywordflow">return</span> startPThreading(std::bind(f,args...));</div>
<div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;    }</div>
<div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;    <span class="keywordtype">bool</span> startPThreading(std::function&lt;<span class="keywordtype">void</span>(<span class="keywordtype">void</span>*)&gt; func);</div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span>* startRoutine(<span class="keywordtype">void</span> *arg);</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;    std::vector&lt;std::unique_ptr&lt;std::thread&gt;&gt; m_threads;</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;};</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160; </div>
<div class="line"><a name="l00285"></a><span class="lineno"><a class="line" href="classlibemb_1_1_thread_pool.html">  285</a></span>&#160;<span class="keyword">class </span><a class="code" href="classlibemb_1_1_thread_pool.html">ThreadPool</a>:<span class="keyword">public</span> <a class="code" href="classlibemb_1_1_singleton.html">Singleton</a>&lt;ThreadPool&gt;{</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;<a class="code" href="_base_type_8h.html#a57e803e49526dc5ba8c1915c68708ae0">DECL_CLASSNAME</a>(<a class="code" href="classlibemb_1_1_thread_pool.html">ThreadPool</a>)</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;<a class="code" href="_singleton_8h.html#adbe81dabafd4a18fb17e8780c0a9190d">DECL_SINGLETON</a>(<a class="code" href="classlibemb_1_1_thread_pool.html">ThreadPool</a>)</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;    ~<a class="code" href="classlibemb_1_1_thread_pool.html">ThreadPool</a>();</div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_thread_pool.html#a35b8db7922d59b99450f537c4ab3baf5">init</a>(<a class="code" href="classlibemb_1_1_thread.html">Thread</a>&amp; protoType,<span class="keywordtype">int</span> <a class="code" href="classlibemb_1_1_thread_pool.html#ae60971906d8c7958c23ff6d536aab218">maxThreadCount</a>);</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classlibemb_1_1_thread_pool.html#a029db4f879f800288410004158e0a7e3">start</a>(<span class="keyword">const</span> <a class="code" href="classlibemb_1_1_runnable.html">Runnable</a>&amp; runnable);</div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classlibemb_1_1_thread_pool.html#ae17d0b1ca43782d2797c9155af4050e9">cancel</a>(<span class="keywordtype">int</span> threadID);</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classlibemb_1_1_thread_pool.html#ae60971906d8c7958c23ff6d536aab218">maxThreadCount</a>();</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classlibemb_1_1_thread_pool.html#a3b81b90cce97232eabec053a12ff380d">idleThreadCount</a>();</div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;    <a class="code" href="classlibemb_1_1_mutex.html">Mutex</a> m_vectMutex;</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;    std::vector&lt;std::unique_ptr&lt;Thread&gt;&gt; m_threadVect;</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;    <span class="keywordtype">int</span> m_maxThreadCount{0};</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;    <span class="keywordtype">int</span> m_usedThreadCount{0};</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;};</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160; </div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;}</div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclasslibemb_1_1_thread_html_ad670751a6bf2d419112e46c92fc527ae"><div class="ttname"><a href="classlibemb_1_1_thread.html#ad670751a6bf2d419112e46c92fc527ae">libemb::Thread::threadID</a></div><div class="ttdeci">static int threadID()</div><div class="ttdoc">获取当前代码所在线程ID</div><div class="ttdef"><b>Definition:</b> Thread.cpp:158</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_html_a3ba546547e2f82a1b908124ff511e97b"><div class="ttname"><a href="classlibemb_1_1_thread.html#a3ba546547e2f82a1b908124ff511e97b">libemb::Thread::stop</a></div><div class="ttdeci">virtual bool stop(int msTimeout=-1)</div><div class="ttdoc">停止线程</div><div class="ttdef"><b>Definition:</b> Thread.cpp:94</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_html_a8d4fca9cb378d5331a1adf493ee0a6a1"><div class="ttname"><a href="classlibemb_1_1_thread.html#a8d4fca9cb378d5331a1adf493ee0a6a1">libemb::Thread::clone</a></div><div class="ttdeci">virtual std::unique_ptr&lt; Thread &gt; clone()</div><div class="ttdoc">克隆函数</div><div class="ttdef"><b>Definition:</b> Thread.cpp:74</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_ac9d64b44a031321d4ab3a2790259bddda539ad1068e9e17018e63246eb2ee1b3d"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddda539ad1068e9e17018e63246eb2ee1b3d">libemb::PThread::SCHED_POLICY_FIFO</a></div><div class="ttdeci">@ SCHED_POLICY_FIFO</div><div class="ttdef"><b>Definition:</b> Thread.h:139</div></div>
<div class="ttc" id="a_singleton_8h_html"><div class="ttname"><a href="_singleton_8h.html">Singleton.h</a></div><div class="ttdoc">单例</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_html_a2e0f619868ec15de65c7940dcc94dba0"><div class="ttname"><a href="classlibemb_1_1_thread.html#a2e0f619868ec15de65c7940dcc94dba0">libemb::Thread::start</a></div><div class="ttdeci">virtual bool start(const Runnable &amp;runnable)</div><div class="ttdoc">启动线程</div><div class="ttdef"><b>Definition:</b> Thread.cpp:79</div></div>
<div class="ttc" id="aclasslibemb_1_1_mutex_html"><div class="ttname"><a href="classlibemb_1_1_mutex.html">libemb::Mutex</a></div><div class="ttdoc">互斥锁类</div><div class="ttdef"><b>Definition:</b> ThreadUtil.h:43</div></div>
<div class="ttc" id="aclasslibemb_1_1_runnable_html_a93b6fff84c5b0f53e5f58509cf716c9d"><div class="ttname"><a href="classlibemb_1_1_runnable.html#a93b6fff84c5b0f53e5f58509cf716c9d">libemb::Runnable::run</a></div><div class="ttdeci">virtual void run()=0</div><div class="ttdoc">线程体主函数</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_a90f937fa8c490b6df2c0f428598e88e4"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#a90f937fa8c490b6df2c0f428598e88e4">libemb::PThread::usleep</a></div><div class="ttdeci">static void usleep(int us)</div><div class="ttdoc">微秒延时函数</div><div class="ttdef"><b>Definition:</b> Thread.cpp:289</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_pool_html"><div class="ttname"><a href="classlibemb_1_1_thread_pool.html">libemb::ThreadPool</a></div><div class="ttdoc">线程池</div><div class="ttdef"><b>Definition:</b> Thread.h:285</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_html"><div class="ttname"><a href="classlibemb_1_1_thread.html">libemb::Thread</a></div><div class="ttdef"><b>Definition:</b> Thread.h:56</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html"><div class="ttname"><a href="classlibemb_1_1_p_thread.html">libemb::PThread</a></div><div class="ttdoc">线程类</div><div class="ttdef"><b>Definition:</b> Thread.h:133</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_ac9d64b44a031321d4ab3a2790259bddda22e3596e79010623b2761584dd92bf4b"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddda22e3596e79010623b2761584dd92bf4b">libemb::PThread::SCHED_POLICY_RR</a></div><div class="ttdeci">@ SCHED_POLICY_RR</div><div class="ttdef"><b>Definition:</b> Thread.h:140</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_html_a05f5a8b508ca2ce08c66dd11e2734b82"><div class="ttname"><a href="classlibemb_1_1_thread.html#a05f5a8b508ca2ce08c66dd11e2734b82">libemb::Thread::msleep</a></div><div class="ttdeci">static void msleep(int ms)</div><div class="ttdoc">毫秒延时函数</div><div class="ttdef"><b>Definition:</b> Thread.cpp:152</div></div>
<div class="ttc" id="a_singleton_8h_html_adbe81dabafd4a18fb17e8780c0a9190d"><div class="ttname"><a href="_singleton_8h.html#adbe81dabafd4a18fb17e8780c0a9190d">DECL_SINGLETON</a></div><div class="ttdeci">#define DECL_SINGLETON(InstanceClass)</div><div class="ttdef"><b>Definition:</b> Singleton.h:44</div></div>
<div class="ttc" id="aclasslibemb_1_1_threading_html_aa3d8e3bf974a6cc2eeb5837a52662dd8"><div class="ttname"><a href="classlibemb_1_1_threading.html#aa3d8e3bf974a6cc2eeb5837a52662dd8">libemb::Threading::threading</a></div><div class="ttdeci">bool threading(Function &amp;&amp;f, Args &amp;&amp;... args)</div><div class="ttdoc">线程化</div><div class="ttdef"><b>Definition:</b> Thread.h:259</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_html_a2b211bf8a128020705fad66e43ce9b5a"><div class="ttname"><a href="classlibemb_1_1_thread.html#a2b211bf8a128020705fad66e43ce9b5a">libemb::Thread::cancel</a></div><div class="ttdeci">virtual bool cancel()</div><div class="ttdoc">强制退出线程</div><div class="ttdef"><b>Definition:</b> Thread.cpp:127</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_pool_html_a35b8db7922d59b99450f537c4ab3baf5"><div class="ttname"><a href="classlibemb_1_1_thread_pool.html#a35b8db7922d59b99450f537c4ab3baf5">libemb::ThreadPool::init</a></div><div class="ttdeci">bool init(Thread &amp;protoType, int maxThreadCount)</div><div class="ttdoc">线程池初始化</div><div class="ttdef"><b>Definition:</b> Thread.cpp:495</div></div>
<div class="ttc" id="a_base_type_8h_html"><div class="ttname"><a href="_base_type_8h.html">BaseType.h</a></div><div class="ttdoc">基础类型头文件</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_html_af1e236f2cb2cec6b64621d783696c73e"><div class="ttname"><a href="classlibemb_1_1_thread.html#af1e236f2cb2cec6b64621d783696c73e">libemb::Thread::isRunning</a></div><div class="ttdeci">virtual bool isRunning()</div><div class="ttdoc">判断线程是否正在运行</div><div class="ttdef"><b>Definition:</b> Thread.cpp:133</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_pool_html_ae60971906d8c7958c23ff6d536aab218"><div class="ttname"><a href="classlibemb_1_1_thread_pool.html#ae60971906d8c7958c23ff6d536aab218">libemb::ThreadPool::maxThreadCount</a></div><div class="ttdeci">int maxThreadCount()</div><div class="ttdoc">返回当前线程池最大线程个数</div><div class="ttdef"><b>Definition:</b> Thread.cpp:561</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_a5ce3c7cbf40e3808380577d0f5d94485"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#a5ce3c7cbf40e3808380577d0f5d94485">libemb::PThread::clone</a></div><div class="ttdeci">std::unique_ptr&lt; Thread &gt; clone() override</div><div class="ttdoc">克隆函数</div><div class="ttdef"><b>Definition:</b> Thread.cpp:187</div></div>
<div class="ttc" id="aclasslibemb_1_1_threading_html"><div class="ttname"><a href="classlibemb_1_1_threading.html">libemb::Threading</a></div><div class="ttdoc">线程化类,用以线程化类成员函数</div><div class="ttdef"><b>Definition:</b> Thread.h:246</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_aead2d7d699206b589e429a06cda8efd9"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#aead2d7d699206b589e429a06cda8efd9">libemb::PThread::start</a></div><div class="ttdeci">bool start(const Runnable &amp;runnable) override</div><div class="ttdoc">启动线程</div><div class="ttdef"><b>Definition:</b> Thread.cpp:192</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_a752d39d4eb36a988b9b24886886373d0"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#a752d39d4eb36a988b9b24886886373d0">libemb::PThread::setAttribute</a></div><div class="ttdeci">void setAttribute(int policy, int priority, bool inherit=false, int stackSize=0)</div><div class="ttdoc">设置线程属性</div><div class="ttdef"><b>Definition:</b> Thread.cpp:269</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_ac9d64b44a031321d4ab3a2790259bddda09c71044114782eba011166cbce6e593"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddda09c71044114782eba011166cbce6e593">libemb::PThread::SCHED_POLICY_OTHER</a></div><div class="ttdeci">@ SCHED_POLICY_OTHER</div><div class="ttdef"><b>Definition:</b> Thread.h:138</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_pool_html_a029db4f879f800288410004158e0a7e3"><div class="ttname"><a href="classlibemb_1_1_thread_pool.html#a029db4f879f800288410004158e0a7e3">libemb::ThreadPool::start</a></div><div class="ttdeci">int start(const Runnable &amp;runnable)</div><div class="ttdoc">启动线程</div><div class="ttdef"><b>Definition:</b> Thread.cpp:518</div></div>
<div class="ttc" id="astructlibemb_1_1_p_thread_1_1_thread_attr_html"><div class="ttname"><a href="structlibemb_1_1_p_thread_1_1_thread_attr.html">libemb::PThread::ThreadAttr</a></div><div class="ttdef"><b>Definition:</b> Thread.h:143</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_aa0c044ad86e4305a515d53eba00fd914"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#aa0c044ad86e4305a515d53eba00fd914">libemb::PThread::msleep</a></div><div class="ttdeci">static void msleep(int ms)</div><div class="ttdoc">毫秒延时函数</div><div class="ttdef"><b>Definition:</b> Thread.cpp:334</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_ac9d64b44a031321d4ab3a2790259bddd"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#ac9d64b44a031321d4ab3a2790259bddd">libemb::PThread::SCHED_POLICY_E</a></div><div class="ttdeci">SCHED_POLICY_E</div><div class="ttdef"><b>Definition:</b> Thread.h:137</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_html_a3577f44fbdabce18815f6ca4578b6ef9"><div class="ttname"><a href="classlibemb_1_1_thread.html#a3577f44fbdabce18815f6ca4578b6ef9">libemb::Thread::usleep</a></div><div class="ttdeci">static void usleep(int us)</div><div class="ttdoc">微秒延时函数</div><div class="ttdef"><b>Definition:</b> Thread.cpp:146</div></div>
<div class="ttc" id="aclasslibemb_1_1_runnable_html"><div class="ttname"><a href="classlibemb_1_1_runnable.html">libemb::Runnable</a></div><div class="ttdoc">线程运行体,子类必须重写run方法.</div><div class="ttdef"><b>Definition:</b> Thread.h:44</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_a9aae9c9d37c8edee17e628505704cd3f"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#a9aae9c9d37c8edee17e628505704cd3f">libemb::PThread::cancel</a></div><div class="ttdeci">bool cancel() override</div><div class="ttdoc">强制退出线程</div><div class="ttdef"><b>Definition:</b> Thread.cpp:239</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_a48db477652aa53f76eb71915bb0c786e"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#a48db477652aa53f76eb71915bb0c786e">libemb::PThread::initWithPreemptRT</a></div><div class="ttdeci">static bool initWithPreemptRT(int policy, int priority)</div><div class="ttdoc">初始化实时抢占系统</div><div class="ttdef"><b>Definition:</b> Thread.cpp:339</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_a67e79a3fcb3d211c66d5c5d13e1a2130"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#a67e79a3fcb3d211c66d5c5d13e1a2130">libemb::PThread::setCancelPoint</a></div><div class="ttdeci">static void setCancelPoint()</div><div class="ttdoc">设置线程取消点</div><div class="ttdef"><b>Definition:</b> Thread.cpp:369</div></div>
<div class="ttc" id="a_base_type_8h_html_a57e803e49526dc5ba8c1915c68708ae0"><div class="ttname"><a href="_base_type_8h.html#a57e803e49526dc5ba8c1915c68708ae0">DECL_CLASSNAME</a></div><div class="ttdeci">#define DECL_CLASSNAME(ClassName)</div><div class="ttdef"><b>Definition:</b> BaseType.h:176</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_pool_html_ae17d0b1ca43782d2797c9155af4050e9"><div class="ttname"><a href="classlibemb_1_1_thread_pool.html#ae17d0b1ca43782d2797c9155af4050e9">libemb::ThreadPool::cancel</a></div><div class="ttdeci">bool cancel(int threadID)</div><div class="ttdoc">停止线程</div><div class="ttdef"><b>Definition:</b> Thread.cpp:540</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_a55465daa7337b735c240359a1816e364"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#a55465daa7337b735c240359a1816e364">libemb::PThread::stop</a></div><div class="ttdeci">bool stop(int msTimeout=-1) override</div><div class="ttdoc">停止线程</div><div class="ttdef"><b>Definition:</b> Thread.cpp:218</div></div>
<div class="ttc" id="aclasslibemb_1_1_singleton_html"><div class="ttname"><a href="classlibemb_1_1_singleton.html">libemb::Singleton</a></div><div class="ttdoc">单例模板类</div><div class="ttdef"><b>Definition:</b> Singleton.h:51</div></div>
<div class="ttc" id="a_thread_util_8h_html"><div class="ttname"><a href="_thread_util_8h.html">ThreadUtil.h</a></div><div class="ttdoc">线程工具</div></div>
<div class="ttc" id="aclasslibemb_1_1_p_thread_html_a7d0f9b8dbf1b0eeeffa2327041dff324"><div class="ttname"><a href="classlibemb_1_1_p_thread.html#a7d0f9b8dbf1b0eeeffa2327041dff324">libemb::PThread::isRunning</a></div><div class="ttdeci">bool isRunning() override</div><div class="ttdoc">判断线程是否正在运行</div><div class="ttdef"><b>Definition:</b> Thread.cpp:260</div></div>
<div class="ttc" id="aclasslibemb_1_1_thread_pool_html_a3b81b90cce97232eabec053a12ff380d"><div class="ttname"><a href="classlibemb_1_1_thread_pool.html#a3b81b90cce97232eabec053a12ff380d">libemb::ThreadPool::idleThreadCount</a></div><div class="ttdeci">int idleThreadCount()</div><div class="ttdoc">返回当前可用线程个数</div><div class="ttdef"><b>Definition:</b> Thread.cpp:567</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
</html>
